home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / misc / math / gpamiga_1_38_3.lha / examples / rho.gp < prev    next >
Encoding:
Text File  |  1993-08-05  |  260 b   |  6 lines

  1. rho1(n,x,y)=x=2;y=5;while(gcd(y-x,n)==1,x=(x*x+1)%n;y=(y*y+1)%n;y=(y*y+1)%n);gcd(n,y-x)
  2. rho2(n,m)=m=rho1(n);if(isprime(m),print(m),rho2(m));if(isprime(n/m),print(n/m),rho2(n/m));
  3. rho(n,m)=m=smallfact(n);print(m);n=m[length(m[,1]),1];if(isprime(n),,rho2(n));
  4.  
  5.  
  6.